<?php

require_once 'common/conn.php';

$db = new DBC();
$usercode = $_GET['usercode'];
if (!isset($usercode)) {
    $usercode = $_POST['usercode'];
}

$data = array();

$sql = "SELECT * FROM t_device WHERE usercode = '".$usercode."'";
$data['user'] = $db->fetchData($sql);
$sql = "SELECT * FROM t_game";
$data['onlinegame'] = $db->fetchData($sql);
// 1 动画故事 2 互动学习 3 益智游戏
$sql = "SELECT * FROM t_product WHERE type1 = 1 AND top = 1 AND status = 1 ORDER BY createdate DESC LIMIT 0,3";
$data['animation'] = $db->fetchData($sql);
$sql = "SELECT * FROM t_music WHERE status = 1 ORDER BY createdate DESC LIMIT 0,3";
$data['music'] = $db->fetchData($sql);
$sql = "SELECT * FROM t_product WHERE type1 = 3 AND top = 1 AND status = 1 ORDER BY createdate DESC LIMIT 0,3";
$data['game'] = $db->fetchData($sql);
echo json_encode($data);
?>